% Main program for phase screen generation by Zernike method
% Written by Benchu Lu; email:benchuul@163.com
% Taiyuan University of Technology
% 主要都是从 <<Numerical Simulation of Optical Wave Propagation,
% with examples in MATLAB>>, Written by Jason D,Schmidt
% 书中的第九章copy下来对应部分的代码
clear; close all; clc;

params.PN = 10; % 相位屏的数量
params.D = 2; % length of one side of square phase screen [m]
params.r0 = 0.1; % coherence diameter [m]
params.N = 256; % number of grid points per side
params.L0 = 10; % outer scale [m] 
params.l0 = 0.01;% inner scale [m]
params.p_num = 3; % 次谐波补偿阶数

ph = ActionFun(params); % 运行相位屏生成函数

% plotting
x = (-params.N/2 : params.N/2-1) * params.D/params.N; 
subplot(121);imagesc(ph(:,:,1)),colorbar;
subplot(122);mesh(x,x,ph(:,:,1)),colorbar;
